{template game_header}

<style>
    .hp-visited a:visited{color: #444;}
    .input-append button{font-size:12px;}
    select,.f12{font-size:12px;}
    #no_user,#user_show{display:none;}
</style>
<div style="clear:both">
    <h5>
        <span class="add-on"><i class="icon-calendar"></i> {if !$isNew}添加{else}修改{/if}奖品信息 </span>
        <span class="add-on">
            <code><a href="?c=adminGame&a=giftInfo">返回奖品列表</a></code>
        </span>
    </h5>
</div>

<table class="table table-striped table-bordered table-hover" height="700"><tr><td>
<div style="clear:both;margin: 50px;">
    <form class="form-horizontal" method="post" enctype="multipart/form-data" action="?c=adminGame&a=giftUpdate" onsubmit="return subtn();">
        <input name="gid" type="text" value="{$prizeInfo['gid']}" style="display:none;">
        <div class="control-group">
            <label class="control-label"><b style="color:red;">*</b>奖品名称 </label>
            <div class="controls">
                <input name="name" type="text" placeholder="奖品名称" value="{$prizeInfo['name']}" style="font-size:12px;">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">图片 </label>
            <div class="controls">
                <input type="hidden" name="keepGiftImg" value="{$prizeInfo['img']}">
                <input name="img" type="file"><img src="{$prizeInfo['img']}" {if !$isNew}style="display:none;"{/if}>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">总数量 </label>
            <div class="controls">
                <input name="total" type="text" placeholder="总数量" value="{$prizeInfo['total']}" style="font-size:12px;">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label"><b style="color:red;">*</b>中奖概率 </label>
            <div class="controls">
                <input name="chance" type="text" placeholder="中奖概率" value="{$prizeInfo['chance']}" style="font-size:12px;">%
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">是否考虑奖品个数 </label>
            <div class="controls">
                <select class="input-small" name="isInfinite">
                    <option value="0" {if $prizeInfo['isInfinite'] == 0}selected="selected"{/if}>是</option>
                    <option value="1" {if $prizeInfo['isInfinite'] == 1}selected="selected"{/if}>否</option>
                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">奖品类型 </label>
            <div class="controls">
                <select class="input-small" name="gift_type">
                    <option value="1" {if $prizeInfo['gift_type'] == 1}selected="selected"{/if}>实物</option>
                    <option value="2" {if $prizeInfo['gift_type'] == 2}selected="selected"{/if}>虚拟</option>
                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">应用渠道 </label>
            <div class="controls">
                <select class="input-small" name="channel">
                    <option value="0" {if $prizeInfo['channel'] == 0}selected="selected"{/if}>app内</option>
                    <option value="1" {if $prizeInfo['channel'] == 1}selected="selected"{/if}>微信中</option>
                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">是否删除 </label>
            <div class="controls">
                <select class="input-small" name="is_show">
                    <option value="0" {if $prizeInfo['is_show'] == 0}selected="selected"{/if}>否</option>
                    <option value="1" {if $prizeInfo['is_show'] == 1}selected="selected"{/if}>是</option>
                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="inputStatus"></label>
            <div class="controls">
                <input type="submit" onclick="subtn" class="btn btn-primary" value="提交">&nbsp;&nbsp;
                <input type="reset" class="btn btn-inverse" value="重置">
            </div>
        </div>
    </form>
</div>
</td></tr></table>

<script type="text/javascript">
    function subtn(){
      var name = $("[name=name]").val();
      var chance = $("[name=chance]").val();
      var total = $("[name=total]").val();
      var isInfinite = $("[name=isInfinite]").val();
      if(name == ''){
        alert("奖品名称不能为空");
        return false;
      }
      if(chance == '' && isNaN(chance)){
        alert("奖品概率不能为空且必须为数字");
        return false;
      }
      if(isInfinite == 0){
        if(total == '' || isNaN(total)){
            alert("当考虑奖品个数时，奖品数量不能为空且必须是大于0的数字");
            return false;
        }
      }
    }
</script>

{template footer}